package cn.edu.bupt.ch5_1.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class IndexController {

    @RequestMapping("/")
    public  String index(Model model){
        model.addAttribute("message", "Hello Spring MVC!");
        return "index";
    }

    @GetMapping(value = "/redirect")
    public String RedirectDemo() {
        return "redirect:/mvdemo";
    }

    @GetMapping(value = "/forward")
    public String ForwardDemo() {
        return "forward:/mvdemo";
    }
}
